import QtQuick 2.0
import Qt3D 1.0
import Qt3D.Shapes 1.0

Item3D {
    id: _root
    property color colorTop: "#ffffff"// "#a4c2f4"      //blue
    property color colorBottom: "#ffffff"   //white
    property color colorNorth: "#ffffff"// "#b6d7a8"    //green
    property color colorSouth: "#ffffff"// "#ffe599"    //yellow
    property color colorEast: "#ffffff"// "#ea9999"     //red
    property color colorWest: "#ffffff"// "#f9cb9c"     //orange

    property variant topPos: _top.position
    property variant bottomPos: _bottom.position
    property variant northPos: _north.position
    property variant southPos: _south.position
    property variant eastPos: _east.position
    property variant westPos: _west.position

    property string texturePath: "Pastel"
    property url textureTop: "Images/" + texturePath + "/textureTop.png"
    property url textureBottom: "Images/" + texturePath + "/textureBottom.png"
    property url textureNorth: "Images/" + texturePath + "/textureNorth.png"
    property url textureSouth: "Images/" + texturePath + "/textureSouth.png"
    property url textureEast: "Images/" + texturePath + "/textureEast.png"
    property url textureWest: "Images/" + texturePath + "/textureWest.png"

    property bool decal: false
    property bool useLighting: true

    //Top
    Quad{
        id: _top
        y: 0.5
        effect: Effect {
            color: _root.colorTop
            texture: _root.textureTop;
            decal: _root.decal
            useLighting: _root.useLighting
        }
        onClicked :{
            console.debug("PICK:TOP");
        }
    }
    //Bottom
    Quad{
        id: _bottom
        y: -0.5
        effect: Effect {
            color: _root.colorBottom
            texture: _root.textureBottom;
            decal: _root.decal
            useLighting: _root.useLighting
         }
        transform: [
            Rotation3D{ angle: 180; axis: Qt.vector3d(1, 0, 0) }
        ]
    }
    //North
    Quad{
        id: _north
        z: 0.5
        effect: Effect {
            color: _root.colorNorth
            texture: _root.textureNorth;
            decal: _root.decal
            useLighting: _root.useLighting
        }
        transform: [
            Rotation3D{ angle: 90; axis: Qt.vector3d(1, 0, 0) }
        ]
    }
    //South
    Quad{
        id: _south
        z: -0.5
        effect: Effect {
            color: _root.colorSouth
            texture: _root.textureSouth;
            decal: _root.decal
            useLighting: _root.useLighting
        }
        transform: [
            Rotation3D{ angle: -90; axis: Qt.vector3d(1, 0, 0) }
        ]
    }
    //East
    Quad{
        id: _east
        x: -0.5
        effect: Effect {
            color: _root.colorEast
            texture: _root.textureEast;
            decal: _root.decal
            useLighting: _root.useLighting
        }
        transform: [
            Rotation3D{ angle: 90; axis: Qt.vector3d(0, 0, 1) }
        ]
    }
    //West
    Quad{
        id: _west
        x: 0.5
        effect: Effect {
            color: _root.colorWest
            texture: _root.textureWest;
            decal: _root.decal
            useLighting: _root.useLighting
        }
        transform: [
            Rotation3D{ angle: -90; axis: Qt.vector3d(0, 0, 1) }
        ]
    }
}
